﻿#region Copyright (c) Nicola Gallo All rights reserved.
/*
 * All rights reserved. Reproduction of trasmission of this file, or a portion thereof,
 * is forbidden without prior written permission of Nicola Gallo.
 * 
 * Author: Nicola Gallo
 * Date: 09/04/2011
 * 
 * */
#endregion
namespace PrismMVC.ModuleA.Controllers
{
    //.NET References
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    //Microsoft References
    using Microsoft.Practices.Prism.Events;
    using Microsoft.Practices.Prism.Logging;
    using Microsoft.Practices.Unity;

    //PrismMVC References
    using PrismMVC.ModuleA.Views;
    using PrismMVC.Shell;
    using PrismMVC.Shell.Containers;
    using PrismMVC.Shell.MVC;
    using PrismMVC.ModuleA.Data;

    /// <summary>
    /// Defines the user's controller.
    /// </summary>
    public class PersonsController : Controller
    {
        //Constructors

        /// <summary>
        /// Creates a new instance of <see cref="PersonsController"/>.
        /// </summary>
        /// <param name="unityContainer">Unity container.</param>
        /// <param name="shellProxy">Shell proxy.</param>
        /// <param name="loggerFacade">Logger facade.</param>
        /// <param name="eventAggregator">Event aggregator.</param>
        public PersonsController(IUnityContainer unityContainer, IShellProxy shellProxy, ILoggerFacade loggerFacade, IEventAggregator eventAggregator)
            : base(unityContainer, shellProxy, loggerFacade, eventAggregator) { }

        //Methods

        /// <summary>
        /// Shows persons.
        /// </summary>
        public ActionResult ShowPersons()
        {
            return new ViewResult(typeof(PersonsView)); 
        }

        /// <summary>
        /// Shows the person with identifier equals to the input <paramref name="personID"/>.
        /// </summary>
        /// <param name="person">Person.</param>
        /// <returns></returns>
        public ActionResult ShowPerson(Person person) 
        {
            this.Module.RunController<ShowPersonController>("ShowPerson", new { person = person }, "detailsRegion");
            return null;
        }
    }
}